<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
ObKit Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="obkitCore.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b>ObKit</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>obkitCore.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		An overview TODO<BR/><BR/>
	
</p>

<hr>



<!-- ========== METHOD SUMMARY =========== -->

	<a name="method_summary"><!-- --></a>
	<table border="1" cellpadding="3" cellspacing="0" width="100%">
		<tr bgcolor="#CCCCFF" class="TableHeadingColor">
			<td colspan=2>
				<font size="+2">
					<b>Method Summary</b>
				</font>
			</td>
		</tr>
	
		
		   <tr bgcolor="white" class="TableRowColor">
		      <td align="right" valign="top" width="1%">
			 <font size="-1">
			    <code>static&nbsp;Object</code>
			 </font>
		      </td>
		      <td>
			 <code>
			    <b>
			       <a href="GLOBALS.html#!s!Person">Person</a></b>(age) * { * this.setAge(age); * }; * * * Function.prototype.implement.preventOverride= false; * * * Employee.inherits(Person); * Employee.define * ( * * function setAge (value) * { * * if (value < 16) * throw new Error('Too young to work here!'); * * * this.parent.setAge.call(this, value); * } * ); * * function Employee (age) * { * * * Person.call(this, age); * }; * * var employee= new Employee (23); * * alert(employee instanceof Person); * * * * alert(Person.type(employee)); * * </pre></code> * * <p> * This method is also usefull in cases where you want to construct objects * indirectly. * </p> * * <code><pre> * * Factory= * { * newInstance: function (Constructor) * { * if (false === Function.type(Constructor)) * throw new Error('Function expected'); * * * var suppliedArgs= [].slice.call(arguments, 1); * * * Proxy.inherits(Constructor); * * function Proxy () * { * Constructor.apply(this, suppliedArgs); * }; * * * return new Proxy; * } * }; * * Mixin.implementStatic * ({ * HIGH_PRIORITY: 1 * , LOW_PRIORITY: 0 * }) * Mixin.implement * ( * { * priority: null * , id: null * } * * , function isHighPriority () * { * return Mixin.HIGH_PRIORITY === this.priority; * } * * , function hasId (value) * { * return this.id === value; * } * ); * * function Mixin (id, importantCondition) * { * this.id= id; * * this.priority= importantCondition ? Mixin.HIGH_PRIORITY : Mixin.LOW_PRIORITY; * }; * * var mixin= Factory.newInstance(Mixin, 12345, true); * , isHighPriority= mixin.isHighPriority(); * , hasId= mixin.hasId(12345); * , isMixinType= Mixin.type(mixin); * * </pre></code> * * @param {Function} Super The constructor to inherit from. * @return {Function} A reference to the function the operation was * applied to, or null, if inheritence could not * be accomplished. * @memberOf Function * @addon */ F.inherits = function (Super)
			 </code>
			 <br>
			 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			 
		      </td>
		   </tr>
		
	
	</table>
    <p>

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/*
 * Copyright (c) 2010, David Foley
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met:
 *
 *     Redistributions of source code must retain the above copyright notice, 
 *     this list of conditions and the following disclaimer.
 * 
 *     Redistributions in binary form must reproduce the above copyright notice, 
 *     this list of conditions and the following disclaimer in the documentation 
 *     and/or other materials provided with the distribution.
 * 
 *     Neither the name of David Foley, OnDevice.ie nor the names of its 
 *     contributors may be used to endorse or promote products derived from this 
 *     software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE.
 */</span>

<span class="comment">/**
 * <span class="attrib">@fileoverview</span> An overview TODO
 */</span>
new <span class="reserved">function</span> ()
{
        <span class="comment">/**
         * <span class="attrib">@private</span>
         * A reference to the Function protoype
         * <span class="attrib">@type</span> Object
         */</span>
    var F= Function.<span class="reserved">prototype</span>
        <span class="comment">/**
         * <span class="attrib">@private</span>
         * A reference to the Array slice method
         * <span class="attrib">@type</span> Function
         */</span>
    ,   S= Array.<span class="reserved">prototype</span>.slice
    
        <span class="comment">/**
         * <span class="attrib">@private</span>
         * The anonymous keyword
         * <span class="attrib">@type</span> String
         */</span>
    ,   A= <span class="literal">'anonymous'</span>;
    
    <span class="comment">/**
     * Add members to a functions prototype. This method can be called on
     * any function, but is designed for use with functions to be used as 
     * constructors. Given a custom constructor of your own making, you can
     * define your object classes in a very readable way.
     * 
     * &lt;code&gt;&lt;pre&gt;
     *     
     *     // Use the implement method on a constructor to define a property
     *     // called 'property', an accessor method named 'getProperty' and
     *     // a mutator method named 'setProperty' by passing it an object literal
     *     // with properties (referred to as a traits provider)
     *     Abstract.implement
     *     (
     *         {
     *             property: null
     *         ,   getProperty: function () 
     *             {
     *                 return this.property;
     *             }
     *             
     *         ,   setProperty: function (value) {
     *             {
     *                 this.property= value;
     *             }
     *         }
     *     );
     *     
     *     // hoisting in JavaScript means you can define your constructor
     *     // after implementing your class properties to improve readability
     *     
     *     function Abstract (value) 
     *     {
     *         this.setProperty(value);
     *     };
     *     
     *     // You can call implement on any constructor at any time. In addition
     *     // to providing a traits provider to the implements method, you can 
     *     // also provide any number of named functions. These functions will
     *     // be added to the prototype by name. The end result is that your
     *     // class definitions become a lot less noisy and easier to read
     *     
     *     Abstract.implement
     *     (
     *         function compare (value) 
     *         {
     *             if (false === value instanceof Abstract)
     *                 return false;
     *             
     *             return this.property === value.getProperty();
     *         }
     *     );
     *     
     *     // you can also supply the prototype of other constructors to
     *     // the implement method on another, and all of its members will be 
     *     // copied over. This is NOT inheritance, but a way of using the
     *     // properties as other objects as 'traits providers'. In the example
     *     // below, AnotherClass.prototype now as all the properties of
     *     // Abstract.prototype
     *     
     *     AnotherClass.implement(Abstract.prototype);
     *     function AnotherClass (value)
     *     {
     *         Abstract.call(this, value);
     *     };
     *     
     *     var value= 'someValue'
     *     ,   abstract= new Abstract(value)
     *     ,   another= new AnotherClass(value)
     *     ,   hasAllAbstractsProperties= true
     *     ,   isAbstract= false
     *     
     *     for (var accessor in Abstract.prototype)
     *     {
     *         if (accessor in another) // always true in this case
     *             continue;
     *             
     *         hasAllAbstractsProperties= false;
     *     }
     *     
     *     // hasAllAbstractsProperties remains true
     *     
     *     isAbstract= another instanceof Abstract // false
     * 
     * &lt;/pre&gt;&lt;/code&gt;
     * &lt;p&gt;
     * Note that Anonymous functions supplied outside of traits providers are 
     * not added to consructor prototypes (as there's nothing to call them), and
     * neither are null values. For best results, use object literals or
     * constructor prototypes as traits providers, and named functions to define
     * methods. The implement method will accept all other values, so try not to 
     * inadvertantly supply strings, numbers and arrays.
     * &lt;/p&gt;
     * 
     * <span class="attrib">@param</span> {...Object} rest    Any number of arguments of any type.
     * <span class="attrib">@return</span> {Function}         A reference to the constructor that the method 
     *                            was called on.
     * 
     * <span class="attrib">@see</span> Function#implementStatic
     * <span class="attrib">@see</span> Function#implement.preventOverride
     * <span class="attrib">@memberOf</span> Function
     * <span class="attrib">@addon</span>
     */</span>
    F.implement= <span class="reserved">function</span> () 
    {
        <span class="reserved">this</span>.implementStatic.apply(<span class="reserved">this</span>.<span class="reserved">prototype</span>, arguments);
        <span class="reserved">return</span> <span class="reserved">this</span>;  
    };

    <span class="comment">/**
     * A flag variable that can be used to determine whether #implementStatic
     * or #implement will prevent the overwriting of members. By default this
     * value is true, meaning that if a trait is supplied to the implement
     * or implementStatic method that has the name of an existing property,
     * it will be skipped.
     * 
     * Flag this variable as false to allow overriding, and note that
     * after each invocation of an implementation method, that its value is
     * reset to true.
     * 
     * &lt;code&gt;&lt;pre&gt;
     * 
     *     Array.implement
     *     (
     *         // this method wont be added to the Array prototype, as by default
     *         // preventOverride is true, and the push method is already defined
     *         function push () 
     *         {
     *             throw new Error ('FUBAR');
     *         }
     *     );
     *     
     *     // turn off protection
     *     Function.prototype.implement.preventOverride= false;
     * 
     *     Array.implement
     *     (
     *         // you're in trouble now! This method will override the native
     *         // push method
     *         function push () 
     *         {
     *             throw new Error ('FUBAR');
     *         }
     *     );
     *     
     *     // no need to turn on protection again, that happens automatically
     *     
     *     Array.implement
     *     (
     *         // preventOverride has been reset to false, so this method
     *         // will not be added
     *         function sort ()
     *         {
     *             throw new Error ('FUBARx2');
     *         }
     *     };
     * 
     * &lt;/pre&gt;&lt;/code&gt;
     * 
     * <span class="attrib">@type</span> {Boolean}
     * 
     * <span class="attrib">@see</span> Function#implementStatic
     * <span class="attrib">@see</span> Function#implement
     * <span class="attrib">@memberOf</span> Function
     * <span class="attrib">@addon</span>
     */</span>
    F.implement.preventOverride= true;

    <span class="comment">/**
     * Add 'static' members to a function. The same rules apply to this method 
     * as the implement method. The difference is that while the
     * implement method adds traits to a constructors prototype, this method
     * adds traits directly to the constructor.
     * 
     * &lt;code&gt;&lt;pre&gt;
     *     
     *     // this is not an endorsement- for example only
     *     Singleton.defineStatic
     *     (
     *         {
     *             // a 'static' property
     *             instance: null
     *         }
     *         
     *         // a 'static' method
     *     ,   function getInstance ()
     *         {
     *             if (this.instance instanceof this)
     *                 return this.instance;
     *                 
     *             return this.instance= new this;
     *         }
     *     );
     *     
     *     function Singleton ()
     *     {
     *         if (this.constructor.instance)
     *             throw new Error ('Singleton already instantiated');
     *     };
     *     
     *     var instance= Singleton.getInstance()
     *     ,   reference= Singleton.getInstance()
     *     
     *     alert(instance === reference); // true
     *     
     *     new Singleton; // throws error
     * &lt;/pre&gt;&lt;/code&gt;
     * 
     * <span class="attrib">@param</span> {...Object} rest   Any number of objects or named functions.
     * <span class="attrib">@return</span> {Function}        A reference to the constructor that this method
     *                           was used on.
     * 
     * <span class="attrib">@see</span> Function#implement
     * <span class="attrib">@see</span> Function#implement.preventOverride
     * <span class="attrib">@memberOf</span> Function
     * <span class="attrib">@addon</span>
     */</span>
    F.implementStatic= <span class="reserved">function</span> () 
    {
        var trait= null
        ,   n= arguments.length
        ,   i= 0
        ,   canOverwrite= !F.implement.preventOverride
        ,   accessor
        
        <span class="reserved">for</span> (; i &lt; n; i++) 
        {
            trait= arguments[i];
            <span class="reserved">if</span> (null == trait)
                continue;

            <span class="reserved">if</span> (<span class="literal">'function'</span> === typeof trait) 
            {
                accessor= trait.getName(); 
                <span class="reserved">if</span> (A !== accessor &amp;&amp; (canOverwrite || !(accessor in <span class="reserved">this</span>)))
                    <span class="reserved">this</span>[accessor]= trait;
            }
            <span class="reserved">else</span> <span class="reserved">for</span> (accessor in trait) 
            {
                <span class="reserved">if</span> (canOverwrite || !(accessor in <span class="reserved">this</span>))
                    <span class="reserved">this</span>[accessor]= trait[accessor];
            }
        }
        
        F.implement.preventOverride= true;
        <span class="reserved">return</span> <span class="reserved">this</span>;
    };

    <span class="comment">/**
     * Determine a functions name. If the function is anonymous, the string
     * 'anonymous' will be returned. This method is especially usefull for
     * reflection.
     * 
     * &lt;code&gt;&lt;pre&gt;
     * 
     *     // this is not an endorsement! for example only
     *     Object.defineStatic
     *     (
     *         function nameFor (value) 
     *         {
     *             if (null == value)
     *                 return String(value);
     *                 
     *             if (value instanceof Function)
     *                 return value.getName();
     *                 
     *             return '[object ' + Object(value).constructor.getName() + ']';
     *         }
     *     );
     *     
     *     function MyClass () {;};
     *     
     *     var instance= new MyClass;
     *     
     *     alert(Object.nameFor(instance)); // alerts '[object MyClass]';
     *     
     * 
     * &lt;/pre&gt;&lt;/code&gt;
     * 
     * <span class="attrib">@return</span> {String}    The name of a function.
     * <span class="attrib">@memberOf</span> Function
     * <span class="attrib">@addon</span>
     */</span>
    F.getName= (<span class="literal">'name'</span> in F) 
    ?
    <span class="reserved">function</span> () 
    {
        var name= <span class="reserved">this</span>.name;
        <span class="reserved">if</span> (<span class="literal">''</span> === name || <span class="literal">'Empty'</span> === name)
            <span class="reserved">return</span> A;
            
        <span class="reserved">return</span> name;
    }
    :
    <span class="reserved">function</span> () 
    {
	    var result = String(<span class="reserved">this</span>).match(/^<span class="reserved">function</span>\s([\w|$]+)/);
	    <span class="reserved">return</span> String(result ? result[1] : A);
    };
    
    <span class="comment">// N.B from this point on we could have used Function.implement but google</span>
    <span class="comment">// closure compiler does not retain function names passed as arguments. For</span>
    <span class="comment">// your own code produced with these extensions, and assuming you want</span>
    <span class="comment">// compression in addition to whitespace removal, do not use named functions</span>
    <span class="comment">// and instead supply an object literal to the implement or implementStatic</span>
    <span class="comment">// methods.</span>
    
    <span class="comment">/**
     * Extend one functions prototype by another, using a constructor as
     * the sole parameter. The inheriting prototype will have an additional
     * property called 'parent' added to it, which will refer to the
     * supertypes prototype.
     * 
     * &lt;code&gt;&lt;pre&gt;
     * 
     *     // Our base class
     *     Person.define
     *     (
     *         {
     *             value: null
     *         }
     *     
     *     ,   function setAge (value)
     *         {
     *             this.value= value;
     *         }
     *         
     *     ,   function getAge ()
     *         {
     *             return this.value;
     *         }
     *     };
     *     
     *     function Person (age)
     *     {
     *         this.setAge(age);
     *     };
     *     
     *     // allow override of the setAge method
     *     Function.prototype.implement.preventOverride= false;
     *     
     *     // inherit from person
     *     Employee.inherits(Person);
     *     Employee.define
     *     (
     *         // override
     *         function setAge (value)
     *         {
     *             // implement a custom gaurd clause
     *             if (value &lt; 16)
     *                 throw new Error('Too young to work here!');
     *             // invoke the supertypes setAge method to
     *             // actually set the age
     *             this.parent.setAge.call(this, value);
     *         }
     *     );
     *     
     *     function Employee (age)
     *     {
     *         // initialize the employee by invoking the supertype
     *         // constructor in the scope of this instance
     *         Person.call(this, age); 
     *     };
     *     
     *     var employee= new Employee (23);
     *     
     *     alert(employee instanceof Person); // true
     *     
     *     // alternatively, you can use the type method
     *     
     *     alert(Person.type(employee)); // true
     * 
     * &lt;/pre&gt;&lt;/code&gt;
     * 
     * &lt;p&gt;
     * This method is also usefull in cases where you want to construct objects
     * indirectly.
     * &lt;/p&gt;
     * 
     * &lt;code&gt;&lt;pre&gt;
     * 
     *     Factory=
     *     {
     *         newInstance: function (Constructor)
     *         {
     *             if (false === Function.type(Constructor))
     *                 throw new Error('Function expected');
     *             
     *             // grab any additional arguments supplid to the newInstnace function
     *             var suppliedArgs= [].slice.call(arguments, 1);
     *             
     *             // subclass the constructor
     *             Proxy.inherits(Constructor);
     *             // parameterise the supertype constructor with the arguments
     *             function Proxy () 
     *             {
     *                 Constructor.apply(this, suppliedArgs);
     *             };
     *             
     *             // and you're done
     *             return new Proxy;
     *         }
     *     };
     *     
     *     Mixin.implementStatic
     *     ({
     *         HIGH_PRIORITY: 1
     *     ,   LOW_PRIORITY: 0
     *     })
     *     Mixin.implement
     *     (
     *         {
     *             priority: null
     *         ,   id: null
     *         }
     *         
     *     ,   function isHighPriority ()
     *         {
     *             return Mixin.HIGH_PRIORITY === this.priority;
     *         }
     *         
     *     ,   function hasId (value)
     *         {
     *             return this.id === value;
     *         }
     *     );
     *     
     *     function Mixin (id, importantCondition)
     *     {
     *         this.id= id;
     *         
     *         this.priority= importantCondition ? Mixin.HIGH_PRIORITY : Mixin.LOW_PRIORITY;
     *     };
     *     
     *     var mixin= Factory.newInstance(Mixin, 12345, true);
     *     ,   isHighPriority= mixin.isHighPriority(); // true
     *     ,   hasId= mixin.hasId(12345); // true
     *     ,   isMixinType= Mixin.type(mixin); // true
     *     
     * &lt;/pre&gt;&lt;/code&gt;
     * 
     * <span class="attrib">@param</span> {Function} Super    The constructor to inherit from.
     * <span class="attrib">@return</span> {Function}         A reference to the function the operation was 
     *                            applied to, or null, if inheritence could not
     *                            be accomplished.
     * <span class="attrib">@memberOf</span> Function
     * <span class="attrib">@addon</span>
     */</span>
    F.inherits= <span class="reserved">function</span> (Super) 
    {
       <span class="reserved">if</span> (<span class="reserved">this</span> === Super || <span class="literal">'function'</span> !== typeof Super)
            <span class="reserved">return</span>;
          
        <span class="reserved">function</span> Intermediary () {;};
        Intermediary.<span class="reserved">prototype</span>= Super.<span class="reserved">prototype</span>;
        Intermediary.<span class="reserved">prototype</span>.parent= Super.<span class="reserved">prototype</span>;
        Intermediary.<span class="reserved">prototype</span>.constructor= <span class="reserved">this</span>;

        <span class="reserved">this</span>.<span class="reserved">prototype</span>= new Intermediary;

        <span class="reserved">return</span> <span class="reserved">this</span>;
    };
    
    <span class="comment">/**
     * Bind or curry a function by supplying an object scope followed by 
     * any number of arguments. If null or undefined is supplied for the
     * scope argument, the function will execute in the global scope.
     * 
     * <span class="attrib">@param</span> {Object} scope      The object scope to execute the method in.
     * <span class="attrib">@param</span> {...Object} rest    Any number of arguments.
     * <span class="attrib">@return</span> {Function}         A curried function.
     * <span class="attrib">@memberOf</span> Function
     * <span class="attrib">@addon</span>
     */</span>
    F.bind= <span class="reserved">function</span> (scope) 
    {
        var method= <span class="reserved">this</span>
        ,   presetArgs= S.call(arguments, 1)

        <span class="reserved">if</span> (presetArgs.length) <span class="reserved">return</span> <span class="reserved">function</span> () 
        {
            <span class="reserved">return</span> method.apply(scope, presetArgs.concat(arguments));
        }
        <span class="reserved">else</span> <span class="reserved">return</span> <span class="reserved">function</span> () 
        {
             <span class="reserved">return</span> method.apply(scope, arguments);
        }
    };
    
    <span class="comment">/**
     * Determine if an object was constructed by this function or one
     * of its subclasses. As a convenience, this method elides the distinction
     * between primitive values and their object counterparts. This rule
     * applies to string, number and boolean only. 
     * 
     * &lt;code&gt;&lt;pre&gt;
     *     
     *     var primitive= 'string';
     *     alert(primitive instanceof Object); // false
     *     alert(primtiive instanceof String); // false!
     *     
     *     // this means checking for strings can be a paaaaiiin
     *     
     *     isString= 'string' === typeof value || value instanceof String
     *     
     *     // this way, its much easier, and the method is available on
     *     // every constructor, including your own.
     *     
     *     alert(String.type(primitive)); // true!
     *     alert(Number.type(0)); // true!
     *     alert(Boolean.type(false)); // true!
     * 
     *     // and of course, it works for your own objects as well
     *     
     *     function WhizzbangSuperDuperClass ()
     *     {
     *         ;
     *     };
     *     
     *     var instance= new WhizzbangSuperDuperClass;
     *     
     *     alert(WhizzbangSuperDuperClass.type(instance)); // true
     * 
     * 
     * &lt;/pre&gt;&lt;/code&gt;
     * 
     * <span class="attrib">@param</span> {Object} value    Any value.
     * <span class="attrib">@return</span> {Boolean}        Whether or not a value is considered a type.
     * <span class="attrib">@see</span> Function#is
     * <span class="attrib">@memberOf</span> Function
     * <span class="attrib">@addon</span>
     */</span>
    F.type= <span class="reserved">function</span> (value) 
    {  
        <span class="reserved">return</span> null == value ? false : Object(value) instanceof <span class="reserved">this</span>;
    };
        
    <span class="comment">/**
     * Determine if an object was constructed by a particular constructor, and 
     * only that constructor.
     * 
     * &lt;code&gt;&lt;pre&gt;
     * 
     *     function Superconstuctor () {};
     *     
     *     Constructor.inherits(Superconstructor);
     *     function Constructor () {};
     *     
     *     alert(Object.is(new Constructor)); // false- not constructed by Object
     *     alert(Object.type(new Constructor)); // true- inherits from Object
     *     alert(Constructor.type(new Constructor)); true- constructed by Constructor
     *     alert(Superconstructor.is(new Constructor)); // false- not constructed by Superconstructor
     *     alert(Superconstructor.type(new Constructor)); // true
     *     
     * 
     * &lt;/pre&gt;&lt;/code&gt;
     * 
     * <span class="attrib">@param</span> {Object} value    Any value.
     * <span class="attrib">@return</span> {Boolean}        Whether or not
     * <span class="attrib">@see</span> Function#type
     * <span class="attrib">@memberOf</span> Function
     * <span class="attrib">@addon</span>
     */</span>
    F.is= <span class="reserved">function</span> (value) 
    {
        <span class="reserved">return</span> null == value ? false : value.constructor === <span class="reserved">this</span>;
    };
    
    <span class="comment">/**
     * Defer a function for execution at a later time. The returned object
     * provides the means to further control the execution of the method and
     * has the following properties:
     * 
     * &lt;code&gt;
     *     hasExecuted:Boolean    whether or not the function has executed
     * &lt;/code&gt;
     * &lt;code&gt;    
     *     createdOn:Number       the UTC time at which the deferred function 
     *                            was created.
     * &lt;/code&gt;
     * &lt;code&gt;
     *     interval:Number        the number of milliseconds until the deferred
     *                            function will be executed
     * &lt;/code&gt;
     * &lt;code&gt;
     *     result:Object          the result of the deferred functions execution, 
     *                            assuming it returns a value. This property is
     *                            set after the deferred function has been
     *                            executed.
     * &lt;/code&gt;
     * &lt;code&gt;
     *     fault:Error            an error object if there was a problem 
     *                            executing the function. This property is
     *                            set after the deferred function has been
     *                            executed.
     * &lt;/code&gt;
     * &lt;p&gt;
     * The returned object has the following methods:
     * &lt;/p&gt;
     * &lt;code&gt;
     *     execute                Executes the function, then disposes of it
     *                            to aid garbage collection. This method can
     *                            be invoked at any time, lest you need to
     *                            execute the deferred method before the 
     *                            interval expires. Note that after invoking
     *                            this method, the deferred function cannot
     *                            be executed again.
     * &lt;/code&gt;
     * &lt;code&gt;                           
     *     dispose                Dispose of the function. The deferred 
     *                            method will be cancelled and not invoked
     *                            again.
     * &lt;/code&gt;
     * &lt;p&gt;
     * You can also define a callback by adding a function called 'onExecute'
     * to the returned object. The callback will be parameterised with a
     * boolean value of true or false pending on whether the deferred function
     * executed normally or encountered a fault while executing.
     * &lt;/p&gt;
     * &lt;code&gt;&lt;pre&gt;
     * 
     *     function sayHi ()
     *     {
     *         sayIt('hi');
     *     };
     *     
     *     function sayIt (message)
     *     {
     *         alert(message);
     *     };
     *     
     *     // defer execution for 100 milliseconds
     *     var deferred= sayHi.defer(100);
     *     // add a callback
     *     deferred.onExecute= function (status)
     *     {
     *         if (status)
     *             alert('executed ok');
     *         else
     *             alert('dammit');
     *     };
     *     
     *     // if you left the above alone, the sayHi method would be executed
     *     // in 100 milliseconds time (or thereabouts- timeout is not exact)
     *     // but lets say that for some reason you want to execute in advance
     *     // of the interval expiring. You can invoke the execute method
     *    
     *     deferred.execute(); 
     *     
     *     // that would have invoked the onExecute call back if one had been
     *     // defined and set the hasExecuted, fault, result values and then
     *     // called the dispose method afterward
     *      
     *     // if you wanted to determine the time expired, this is how you
     *     // you would do it
     *     
     *     var now= new Date().getTime()
     *     ,   duration= now - deferred.createdOn
     *     ,   timeRemainingIfIHadntExecuted= deferred.interval - duration
     * 
     *     // alternatively, you may want to abort a deferred method. Assuming
     *     // you haven't already executed, you can just do this
     *     
     *     deferred.dispose(); 
     *     
     *     // that cancelled the deferred method from executing and removed
     *     // some internal references to faciliate garbage collection. The
     *     // onExecute call back was not invoked, and no other properties
     *     // were changed
     * 
     * &lt;/pre&gt;&lt;/code&gt;
     * 
     * <span class="attrib">@param</span> {Number} interval   The number of milliseconds to expire before 
     *                            executing this function
     * <span class="attrib">@param</span> {Object} scope      Optional. An object scope in which to 
     *                            execute this function
     * <span class="attrib">@param</span> {...Object} rest    Any number of arguments to curry the 
     *                            function with
     * <span class="attrib">@return</span> {Object}           The deferred object detailed above.
     * <span class="attrib">@see</span> Function#bind
     * <span class="attrib">@memberOf</span> Function
     * <span class="attrib">@addon</span>
     */</span>
    F.defer= <span class="reserved">function</span> (interval, scope) 
    {
        var method= <span class="reserved">this</span>.bind.apply(<span class="reserved">this</span>, [scope].concat(S.call(arguments, 2)))
        ,   deferred= 
            {
                hasExecuted: false
            ,   createdOn: new Date().getTime()
            ,   interval: interval
            ,   result: null
            ,   fault: null
            ,   dispose: <span class="reserved">function</span> () 
                {
                    clearTimeout(<span class="reserved">this</span>.timeoutId);
                    delete <span class="reserved">this</span>.timeoutId;
                    <span class="reserved">this</span>.execute= <span class="reserved">function</span> () {;};
                    method= null;
                }
            ,   execute: <span class="reserved">function</span> () 
                {
                    var status= false;
                    deferred.hasExecuted= true;
                    try 
                    {
                        deferred.result= method();
                        status= true;
                    }
                    catch (thrown) 
                    {
                        deferred.fault= thrown;
                    }
                    deferred.dispose();
                    <span class="reserved">if</span> (<span class="literal">'function'</span> === typeof deferred.onExecute)
                        deferred.onExecute(status);
                }
            };
        
        deferred.timeoutId= setTimeout(deferred.execute, interval);
        <span class="reserved">return</span> deferred;
    };
};
</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b>ObKit</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Thu Aug 12 14:21:40 2010</div>
</body>
</html>
